package com.lagou;

import com.lagou.config.SpringConfig;
import com.lagou.domain.Course_Section;
import com.lagou.service.CourseContentService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

//@RunWith指定junit的运行环境  SpringJUnit4ClassRunner是spring提供的作为junit运行环境的类
@RunWith(SpringJUnit4ClassRunner.class)
// 引入核心配置文件
//@ContextConfiguration(classes = {SpringConfig.class})
@ContextConfiguration(value = {"classpath:applicationContext.xml"})
public class test {

    @Autowired
    private CourseContentService contentService;    // 从IOC容器中获取到CourseContentService对象

    @Test
    public void testSaveSection() {

        Course_Section section = new Course_Section();
        section.setCourse_id(59);
        section.setSection_name("spring测试");
        section.setDescription("spring测试");
        section.setOrder_num(8);

        String s = contentService.saveSection(section);
        System.out.println(s);
    }
}
